﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminSite.Master" Inherits="System.Web.Mvc.ViewPage<MensUnoShop.Models.NormalMarket>" ValidateRequest="false" %>
<%@ Import Namespace="MvcPaging"%>  
<%@ Import Namespace="MensUnoShop.Helpers" %>
<%@ Import Namespace="MensUnoShop.Areas.Admin.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Market
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<div id="main-content" class="hastable">
	<div class="title title-spacing">
		<h2>賣場編輯</h2>
			編輯賣場資料
	</div>
    <%using (Html.BeginForm("../Product/Market", "Product", FormMethod.Post, new { @class = "shBox", enctype = "multipart/form-data", onsubmit = "return checkTag();" }))
    {%>
    <table cellspacing="0">
    <thead>
        <tr>
            <td style="width:100px">賣場分類</td>
			<td style="width:300px; text-align:left;" align="left;">
            <span>目前分類：[<%:ViewData["MasterC"] %>]-[<%:ViewData["SlaveC"] %>]<input type="button" value="修改分類" onclick="javascript:document.getElementById('editlevel').style.display='block';" /></span><br />
            <span id="editlevel" style="display:none">調整分類：
            <%:Html.DropDownList("FirstLevel", (IEnumerable<SelectListItem>)ViewData["FirstLevelList"])%> - 
            <%:Html.DropDownList("SecondLevel", new List<SelectListItem> { new SelectListItem() { Text = "請先選左方分類", Value = "" } })%>
            </span>
            </td>
            <td style="width:100px"><%:Html.Hidden("MKguid", ViewData["MKguid"])%></td>        
        </tr>
		<tr>
			<td style="width:100px">商品貨號</td>
			<td style="width:300px; text-align:left;" align="left;"><%:Html.TextBox("MKsn", ViewData["MKsn"])%></td>
            <td style="width:100px"></td>
		</tr>        
		<tr>
			<td style="width:100px">賣場名稱</td>
			<td style="width:300px; text-align:left;" align="left;"><%:Html.TextBox("MKtitle", ViewData["MKtitle"], new { @size = "80" })%></td>
            <td style="width:100px"></td>
		</tr>
		<tr>
			<td style="width:100px">訂價</td>
			<td style="width:300px; text-align:left;" align="left;"><%:Html.TextBox("MKshowPrice", ViewData["MKshowPrice"])%></td>
            <td style="width:100px"></td>
		</tr>
		<tr>
			<td style="width:100px">售價</td>
			<td style="width:300px; text-align:left;" align="left;"><%:Html.TextBox("MKprice", ViewData["MKprice"])%></td>
            <td style="width:100px"></td>
		</tr>
		<tr>
			<td style="width:100px">開賣時間</td>
			<td style="width:300px; text-align:left;" align="left;"><%:Html.TextBox("MKsdate", ViewData["MKsdate"], new { @class = "datepicker" })%>~<%:Html.TextBox("MKedate", ViewData["MKedate"], new { @class = "datepicker" })%></td>
            <td style="width:100px"></td>
		</tr>
		<tr>
			<td style="width:100px">賣場說明</td>
			<td style="width:300px; text-align:left;" align="left;"><%=Html.TextArea("MKintroduction", (string)ViewData["MKintroduction"], new { @name = "ckEditor1" })%></td>
            <td style="width:100px"></td>
		</tr>
		<tr>
			<td style="width:100px">訂購說明</td>
			<td style="width:300px"><%:Html.TextArea("MKshoppingnote", (string)ViewData["MKshoppingnote"], new { @name = "ckEditor2" })%></td>
            <td style="width:100px"></td>
		</tr>
		<tr>
			<td style="width:100px">規格說明</td>
			<td style="width:300px; text-align:left;" align="left;"><%:Html.TextArea("MKspec", (string)ViewData["MKspec"], new { @name = "ckEditor3" })%></td>
            <td style="width:100px"></td>
		</tr>
		<tr>
			<td style="width:100px">洗滌說明</td>
			<td style="width:300px; text-align:left;" align="left;"><%:Html.TextArea("MKwashnote", (string)ViewData["MKwashnote"], new { @name = "ckEditor4" })%></td>
            <td style="width:100px"></td>
		</tr>
        <tr>
			<td style="width:100px">色彩群組</td>
			<td style="width:300px; text-align:left;" align="left;">
            <span>目前：[<%:ViewData["MKColorGroup"]%>]<input type="button" value="修改" onclick="javascript:document.getElementById('ColorGroup').style.display='block';" /></span><br />
            <span id="ColorGroup" style="display:none">調整色彩群組：
            <%:Html.DropDownList("MKColorGroupList", (IEnumerable<SelectListItem>)ViewData["MKColorGroupList"])%>
            </span>            
            </td>
            <td style="width:100px"></td>
		</tr>
        <tr>
			<td style="width:100px">系列款</td>
			<td style="width:300px; text-align:left;" align="left;">
            <span>目前：[<%:ViewData["MKGroup"]%>]<input type="button" value="修改" onclick="javascript:document.getElementById('Grouptag').style.display='block';" /></span><br />
            <span id="Grouptag" style="display:none">調整系列款：
            <%:Html.DropDownList("MKGroupList", (IEnumerable<SelectListItem>)ViewData["MKGroupList"])%>
            </span>
            </td>
            <td style="width:100px"></td>
		</tr>        
		<%--<tr>
			<td style="width:100px">賣場狀態</td>
			<td style="width:300px"><%:Html.CheckBox("MKstatus", ViewData["MKstatus"])%>(v表示上架狀態)</td>
            <td style="width:100px"></td>
		</tr>--%>
        <tr>
			<td style="width:100px">最近修改時間</td>
			<td style="width:300px; text-align:left;" align="left;"><%:Html.Label((string)ViewData["MKlastmodify"])%></td>
            <td style="width:100px"></td>
		</tr>
		<tr>
			<td style="width:100px">新增時間</td>
			<td style="width:300px; text-align:left;" align="left;"><%:Html.Label((string)ViewData["MKdatein"])%></td>
            <td style="width:100px"></td>
		</tr>
        <tr>
			<td style="width:100px"></td>
			<td style="width:300px">
                <input type="submit" class="submit" value="儲存" />
            <%if (ViewData["MKguid"] != null)
              {%>
                <input type="button" value="商品列表" onclick="javascript:location.href='/Admin/Product/ProductDetail/<%:ViewData["MKguid"] %>'" />    
                <input type="button" value="圖說列表" onclick="javascript:location.href='/Admin/Product/MarketPictureDetail/<%:ViewData["MKguid"] %>'" />
            <%} %>
            <input type="button" value="賣場列表" onclick="location.href='/Admin/Product/MarketList?page=0'" />
            </td>
            <td style="width:100px"></td>
		</tr>
	</thead>    
    </table>
    <%} %>
    <br/><br/>            
</div>

<script type="text/javascript">   
    $(document).ready(function () {
        $("#FirstLevel").trigger("change");
    });

    $("#FirstLevel").change(GetSubTagList);
    function GetSubTagList() {
        $.getJSON("/admin/Product/GetSubTagList/", { pid: $("#FirstLevel").val() }, function (data) {
            $("#SecondLevel").empty();
            $("#SecondLevel").append('<option value="">=請選擇=</option>');
            $.each(data, function (i, item) {
                //if ($("#MKgrouptagid").val() == item["Value"]) {                    
                //    $("<option></option>").val(item["Value"]).text(item["Text"]).attr("selected", "true").appendTo($("#SecondLevel"));
                //} else {
                    $("<option></option>").val(item["Value"]).text(item["Text"]).appendTo($("#SecondLevel"));
                //}
            });
            $("#SecondLevel").trigger("change");
        });
    }
    $("#SecondLevel").change(function () { });


    CKEDITOR.replace('MKintroduction',
    {
        height: 300,
        skin: 'kama',
        filebrowserImageUploadUrl: '/admin/product/ImgUpload',
        toolbarCanCollapse: true,
        toolbar:
        [
            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'Anchor'],
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-'],
            ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
            ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', '-', 'TextColor', 'BGColor'],
            ['Styles', 'Format', 'Font', 'FontSize']
        ]
    });
    CKEDITOR.replace('MKshoppingnote',
    {
        height: 300,
        skin: 'kama',
        filebrowserImageUploadUrl: '/admin/product/ImgUpload',
        toolbarCanCollapse: true,
        toolbar:
        [
            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'Anchor'],
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-'],
            ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
            ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', '-', 'TextColor', 'BGColor'],
            ['Styles', 'Format', 'Font', 'FontSize']
        ]
    });
    CKEDITOR.replace('MKspec',
    {
        height: 300,
        skin: 'kama',
        filebrowserImageUploadUrl: '/admin/product/ImgUpload',
        toolbarCanCollapse: true,
        toolbar:
        [
            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'Anchor'],
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-'],
            ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
            ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', '-', 'TextColor', 'BGColor'],
            ['Styles', 'Format', 'Font', 'FontSize']
        ]
    });
    CKEDITOR.replace('MKwashnote',
    {
        height: 300,
        skin: 'kama',
        filebrowserImageUploadUrl: '/admin/product/ImgUpload',
        toolbarCanCollapse: true,
        toolbar:
        [
            ['Bold', 'Italic', 'Underline', 'Strike', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'Anchor'],
            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-'],
            ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
            ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', '-', 'TextColor', 'BGColor'],
            ['Styles', 'Format', 'Font', 'FontSize']
        ]
    });

    function checkTag() {
        if ($("#editlevel").css("display") != "none" && $("#SecondLevel").val() == "") { alert("請選擇分類"); return false; }
        else if($("#editlevel").css("display") == "none" && "<%:ViewData["SlaveC"] %>"=="") { alert("請選擇分類"); return false; }
        if ($("#MKtitle").val().length>50) { alert("標題最多50字!");  $("#MKtitle").focus();return false; }
    }
    
</script>

</asp:Content>
